package leetcode;

import java.util.LinkedList;
import java.util.List;

public class Solution78 {

    private LinkedList<List<Integer>> res = new LinkedList<>();
    private LinkedList<Integer> track = new LinkedList<>();
    public List<List<Integer>> subsets(int[] nums) {
        doTrack(nums,0);
        return res;

    }

    private void doTrack(int[] nums, int start) {
        res.add(new LinkedList<>(track));
        for (int i = start; i <nums.length ; i++) {
            track.add(nums[i]);
            doTrack(nums,i+1);
            track.removeLast();
        }

    }
}
